

def encode(s):
	es = ""
	for c in s:
		n = (ord(c) + 5 - 0x20) % 0x5F + 0x20
		es += chr(n)
	return es
		
def decode(s):
	ds = ""
	for c in s:
		n = (ord(c) - 5 - 0x20 + 0x5F ) % 0x5F + 0x20
		ds += chr(n)
	return ds
			
			
			
s = "TP xyz(900)~001"

es = encode(s)
ds = decode(es)

print "INPUT: ", s
print "ENCODE:", es
print "DECODE:", ds




